<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<title>致一年未见的你</title>
	<link rel="stylesheet" href="css/common.css">
	<style type="text/css">
		body{background: none;}
		.appoint{width:80%;margin:0 auto;}
		.sucwrap{padding:2% 10%;color:#fff;background: url(images/suc_02.png) no-repeat;background-size: 100% 100%;}
		.suc_tip{font-size: 16px;font-weight: bold;margin:15px 0;}
		.footer{padding-top: 5%;}
		#global {position:absolute;left:0;top: 0; width:100%; height:100%;z-index:9; display:none; overflow:hidden;}
	</style>
</head>
<body>
	<div class="pic">
		<img src="images/suc_01.png">
	</div>
	<div class="sucwrap">
		<!-- 劵号： -->
		<p id="lett">劵号:</p>
		<div class="center suc_tip">
			请于2017年9月30日前进行预约，不然就失效了！
		</div>
		<div class="paddB-20">快点戳下面预约按钮去预约，到店后出示券号即可享受高端动力系统养护套餐咯。</div>
	</div>
	<!-- 预约按键 -->
	<div class="appoint pic marginY-30">
		<img src="images/suc_btn.png" alt="">
	</div>
	<div class="pic footer">
		<img src="images/footer.png" alt="">
	</div>	
	 <div class="num"></div>
	<div id="global"></div>
</body>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="../../../js/common/common.js"></script>
<script type="text/javascript" src="../../../js/common/wechatCommon.js"></script>
<script type="text/javascript" src="js/notReturnFactorCommon.js"></script>
<script type="text/javascript" src="js/snowfall.jquery.js"></script>
<script>
	var rootPath = getRootPath();
	$(function(){
		//根据id查询奖券信息
		$.ajax({
			headers: {'Cookie' : document.cookie },
			//url:'http://127.0.0.1:9013/pointActivity/api/v1/findUserAndIalize',
			url:rootPath + '/pointActivity/api/v1/findUserAndIalize',
			dataType:"json",
			type:"POST", 
			beforeSend: function(){    
				showLoadding();
			},
			success:function(data){
				for(var i in data){
					var code=data[i];
					if(code=="客户奖券查询异常"){
						$("#lett").html("劵号：xxx");
						$(".center").text("非常抱歉！网络异常，奖券查询丢失了！");
						$(".appoint").unbind();     //取消点击绑定
					}else{						
					    $("#lett").text("劵号: "+code+"");						
					}
				}
			},
			complete: function(){
				hideLoadding();
			 }
		});
		
		//中奖特效
		 $("#global").show();
		$("#global").snowfall({
			image: "images/huaban2.png",
			flakeCount:20,
			minSize: 10,
			maxSize: 50
		});
		 //点击取消特效
		$("#global").click(function(){
			$("#global").snowfall('clear');
			$(this).hide();
		});
		
	})
	
	//根据openId查询是否预约
		//预约按键事件
			$('.appoint').click(function(){
				$.ajax({
					headers: {'Cookie' : document.cookie },
					//url:'http://127.0.0.1:9013/pointActivity/api/v1/getByOpenId',
					url:rootPath + '/pointActivity/api/v1/getByOpenId',
					dataType:"json",
					type:"POST", 
					success:function(data){
 						if(data.message!=null){
 							showAlert("您已预约成功！请准时到店参加保养")
 						}else{				
 						window.location.replace(rootPath + "/views/gmmcActivity/NotReturnFactory/reservation3.html?random="+ parseInt(10000 * Math.random())); //预约页面
 						}
					}
				});
			})
	
</script>
</html>